**Author: Abeberese, Barnwal, Chaurey, Mukherjee
**This do-file will generate Table 1
**Date: May 2021


clear
capture log close
set matsize 4000
set scheme s2mono, perm
ssc install  did_multiplegt

**Set directories
*Add personal root path for your machine directory

global ROOT "/Users/rchaurey/Dropbox/Indonesia Firms/DataFolderRESTAT/"
global dofiles "${ROOT}/Code"
global data "${ROOT}/Input"
global output "${ROOT}/Output"


****************************************************************************************************************************************************
*START ANALYSIS
use "${data}/mayor_manufactureBaselineRegressions_longrun", clear

xtset idno year

***Label variables
label variable log_labor_productivity "log [labor productivity]"
label variable ltfpLP "log [TFP]"
label variable log_v_production "log [output]"


gen firstdemyr = mayor_appyr+5
gen post = year>=firstdemyr

******************************************************************************
**Table 1
******************************************************************************
***DID
**with ind5year FE
foreach v of varlist log_labor_productivity ltfpLP  log_v_production {
reghdfe `v' post,   absorb( idno ind5year)  cluster(district)
outreg2 using "${output}/Table1.xls", ///
keep(post)  append addtext(firm FE, Yes, 5 digit industry X year FE, Yes, sample, 1993-96:99-2014)

}




******************************************************************************
**Figure 1
******************************************************************************
*** Chaisemartin and D'Haultfoeuille (2019)

foreach v of varlist log_labor_productivity ltfpLP  log_v_production {
set seed 843129669

did_multiplegt `v' idno  year post, breps(50) trends_nonparam(ind5)  placebo(5)  cluster(district)
eret list
graph save "${output}/DIDMultipleGT`v'_fig1", replace
}


